home *** CD-ROM | disk | FTP | other *** search
/ Champak 29 / Volume 29 - JOGO DISK .iso / Games / mystic_training.swf / scripts / __Packages / ObjBKG.as next >
Text File  |  2006-11-13  |  2KB  |  65 lines

  1. class ObjBKG extends MovieClip
  2. {
  3.    function ObjBKG(P_mcRef, P_nSpeedMax)
  4.    {
  5.       super();
  6.       this._sType = "Background";
  7.       this._nSpeed = 0;
  8.       this._nSpeedMax = P_nSpeedMax;
  9.       this._nDirection = -1;
  10.       this._nAccel = 0.2;
  11.       this._bStop = false;
  12.       this._nLSMappingDistanceToDo = 0;
  13.       this._nLSMappingDistanceDone = 0;
  14.       _global.C.fAddActiveElement(this);
  15.       this.mcRef = P_mcRef;
  16.    }
  17.    function fDoAction()
  18.    {
  19.       this.fCheckMappingDistance();
  20.       if(this._bStop == false)
  21.       {
  22.          this.fMoveTerrain(this._nAccel,this._nDirection);
  23.       }
  24.    }
  25.    function fCheckMappingDistance()
  26.    {
  27.       if(this._nLSMappingDistanceDone >= this._nLSMappingDistanceToDo)
  28.       {
  29.          _global.C.fGetLSMapped();
  30.          this._nLSMappingDistanceToDo += _global.C._nLSMappingPixelRange;
  31.       }
  32.    }
  33.    function fMoveTerrain(l_accel, l_direction)
  34.    {
  35.       this._nDirection = l_direction;
  36.       this._nAccel = l_accel;
  37.       if(this._nSpeed < this._nSpeedMax - this._nAccel)
  38.       {
  39.          this._nSpeed += this._nAccel;
  40.       }
  41.       else
  42.       {
  43.          this._nSpeed = this._nSpeedMax;
  44.       }
  45.       this.mcRef._x += this._nSpeed * this._nDirection;
  46.       this._nLSMappingDistanceDone += this._nSpeed;
  47.       if(_global.C.G_CurrentGame == "Blue")
  48.       {
  49.          if(_global.C.PowerRanger._bStack == false)
  50.          {
  51.             _global.C.PowerRanger.mMc._x -= this._nSpeed * this._nDirection;
  52.          }
  53.       }
  54.       else
  55.       {
  56.          _global.C.PowerRanger.mMc._x -= this._nSpeed * this._nDirection;
  57.       }
  58.       _global.C._parent.mcMain.mcInterface._x -= this._nSpeed * this._nDirection;
  59.       this.mcRef.mcGuideZero._x -= this._nSpeed * this._nDirection;
  60.       this.mcRef.mcBackground._x -= this._nSpeed * this._nDirection;
  61.       _global.C.PowerRanger.mMcHit._x -= this._nSpeed * this._nDirection;
  62.       _global.C._parent.mcMain.mcInstructions._x -= this._nSpeed * this._nDirection;
  63.    }
  64. }
  65.